package com.itheima.dao;

import com.itheima.entity.User;
import org.apache.ibatis.annotations.*;

/**
 * @author 黑马程序员
 * @Company http://www.ithiema.com
 * @Version 1.0
 */
public interface UserMapper {

    @Results({
            @Result(column = "username",property = "userName"),
            @Result(column = "address", property = "homeAddress"),
            @Result(property = "userInfo",column = "id",
                one = @One(select = "com.itheima.dao.UserInfoMapper.selectUserInfoByUserId")),
            @Result(property = "orders", column = "id",
                many = @Many(select = "com.itheima.dao.OrderMapper.selectOrderByUserId"))
    })
    @Select("select * from t_user where id = #{id}")
    User selectById(@Param("id") Integer id);
}
